﻿using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using System;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Xml.Schema;

namespace ScormModel
{
    [Serializable()]
    public class LimitConditions
    {
        private string _attemptLimit;
        private string _attemptAbsoluteDurationLimit;
         [NonSerialized]
        private XmlNode _limitConditionsContent;
        [XmlAttribute("attemptLimit")]
        public string AttemptLimit
        {
            get { return this._attemptLimit; }
            set { this._attemptLimit = value; }
        }
        [XmlAttribute("attemptAbsoluteDurationLimit")]
        public string AttemptAbsoluteDurationLimit
        {
            get { return this._attemptAbsoluteDurationLimit; }
            set { this._attemptAbsoluteDurationLimit = value; }
        }
        
        [XmlIgnoreAttribute]
        public XmlNode LimitConditionsContent
        {
            get { return this._limitConditionsContent; }
            set { this._limitConditionsContent = value; }
        }
        public void buildLimitConditions()
        {
            XmlAttributeCollection attList = _limitConditionsContent.Attributes;
            if (attList.GetNamedItem("attemptLimit") != null)
            {
                _attemptLimit = ((XmlAttribute)attList.GetNamedItem("attemptLimit")).Value;
            }
            if (attList.GetNamedItem("attemptAbsoluteDurationLimit") != null)
            {
                _attemptAbsoluteDurationLimit = ((XmlAttribute)attList.GetNamedItem("attemptAbsoluteDurationLimit")).Value;
            }
        }
    }
}
